#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
路径配置模块
包含项目中使用的各种文件路径
"""

import os
import sys
from pathlib import Path

# 获取项目根目录
BASE_DIR = Path(__file__).resolve().parent.parent

# 配置文件
CONFIG_DIR = BASE_DIR / "config"
CONFIG_FILE = CONFIG_DIR / "config.ini"

# 数据和资源文件
ASSETS_DIR = BASE_DIR / "assets"
SYMBOL2ID_FILE = ASSETS_DIR / "symbol2id.json"
LEXICON_FILE = ASSETS_DIR / "lexicon.txt"
SPEAKERS_FILE = ASSETS_DIR / "speakerCategories.json"

# 模型文件
MODELS_DIR = BASE_DIR / "models"
TORCH_MODELS_DIR = MODELS_DIR / "torchscript"
CHECKPOINT_DIR = MODELS_DIR / "checkpoints"

# NLTK数据目录
DATA_DIR = BASE_DIR / "data"
NLTK_DATA_DIR = DATA_DIR / "nltk_data"

# 临时音频文件
TEMP_DIR = BASE_DIR / "temp"
AUDIO_OUTPUT_FILE = TEMP_DIR / "audio.wav"

# Google Drive模型文件夹ID
GDRIVE_FOLDER_ID = "1LVHA7L-qaPXuSgodxFQy3nrtsL5iqqiX"

def create_directories():
    """创建必要的目录结构"""
    dirs = [
        CONFIG_DIR,
        ASSETS_DIR,
        MODELS_DIR,
        TORCH_MODELS_DIR,
        CHECKPOINT_DIR,
        TEMP_DIR,
        DATA_DIR,
        NLTK_DATA_DIR,
        NLTK_DATA_DIR / "corpora",
        NLTK_DATA_DIR / "taggers"
    ]
    
    for directory in dirs:
        os.makedirs(directory, exist_ok=True)
        
    # 创建.gitkeep文件，确保空目录可以被Git跟踪
    for directory in [MODELS_DIR, TEMP_DIR, DATA_DIR]:
        gitkeep_file = directory / ".gitkeep"
        if not gitkeep_file.exists():
            gitkeep_file.touch()
            
    print(f"已创建项目目录结构: {BASE_DIR}")
    
if __name__ == "__main__":
    create_directories() 